import {Entity, PrimaryGeneratedColumn, Column, OneToOne, JoinColumn} from "typeorm";
import {Online} from "./Online";
import {Stage} from "./Stage";
import {Quest} from "./Quest";
import { Query } from "typeorm/driver/Query";

@Entity("roles")
export class Role {

    @PrimaryGeneratedColumn()
    role_id: number;

    @Column()
    user_id: number;

    @Column()
    server_id: number;

    @Column({nullable:true})
    name: string;

    @Column()
    level: number;

    @Column()
    vip: number;

    @Column()
    power: number;

    @Column()
    created_at: string;

    @OneToOne(type => Online)
    @JoinColumn({name: 'role_id'})
    online: Online;

    @OneToOne(type => Stage)
    @JoinColumn({name: 'role_id'})
    stage: Stage;
    
    @OneToOne(type => Quest)
    @JoinColumn({name: 'role_id'})
    quest: Quest;
}

